import type { IconfontPageType } from '../../../../../../lib/page_handler/platform/iconfont/types'
import type { IconfontElements } from '../../../../../../types/constants/personalization/iconfont'
import type { ThemeType } from '../../../../../../types/interfaces'
import { OthersThemeService } from '../../../../../../lib/abstract'
import { PageHandler } from '../../../../../../lib/page_handler'
import {
  BODY_SELECTOR,
  PLATFORM_PAGE_TYPES,
  SUPPORTED_PLATFORMS,
} from '../../../../../../types/constants'

/**
 * 主题服务测试链接
 */
export class IconfontThemeService extends OthersThemeService {
  readonly name: string = 'IconfontTheme'
  readonly platformPageType: string = PLATFORM_PAGE_TYPES.OTHERS.value
  private static instance: IconfontThemeService
  declare readonly elements: IconfontElements
  private readonly pageHandler: PageHandler = PageHandler.getInstance()
  private currentPageType: IconfontPageType | 'default' = this.pageHandler.pages.iconfont.pageType
  readonly wrapperSelector: string = BODY_SELECTOR

  constructor() {
    super(SUPPORTED_PLATFORMS.ICONFONT)

    this.updateElementStylesForTheme()
    this.checkPageType(this.currentPageType)
  }

  /**
   * 获取单例实例
   */
  static getInstance(): IconfontThemeService {
    if (!IconfontThemeService.instance) {
      IconfontThemeService.instance = new IconfontThemeService()
    }
    return IconfontThemeService.instance
  }

  /**
   * 批量初始化页面样式
   */
  updateElementStylesForTheme(): void {}

  platformStyleVar(_theme: ThemeType): string {
    return ``
  }

  getBaseStyles(_theme: ThemeType): string {
    return ``
  }

  getPageStyles(_theme: ThemeType): string {
    return `
${BODY_SELECTOR} { 
  background-color: #000000 !important;
}
    `
  }

  getMainStyles(_theme: ThemeType): string {
    return ``
  }

  getPatchedStyles(_theme: ThemeType): string {
    return ``
  }

  getFixedStyles(_theme: ThemeType): string {
    return ``
  }
}
